#include "where.h"

Where::Where(Expression * expression)
{
	if(expression == NULL) this->expression = NULL;
	else this->expression = expression->clone();
}
Where::Where(const Where& other)
{
	if(other.expression != NULL) expression = other.expression->clone();
	else expression = NULL;
}

Where::~Where()
{
    delete expression; expression = NULL;
}

void Where::setExpression(Expression * expression)
{
	delete this->expression; this->expression = NULL;
	this->expression = expression->clone();
}

Expression * Where::getExpression()
{
    return expression;
}

string Where::toString()
{
    if(expression != NULL) return expression->toString();
    else return "";
}

Where * Where::clone()
{
    return new Where(*this);
}
